home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / mxlibs / sblib / dsp8.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-11  |  1.7 KB  |  56 lines

  1. #ifndef DSP8_H
  2. #define DSP8_H
  3.  
  4.  
  5. //Return code for InitDsp.
  6. //~~~~~~~~~~~~~~~~~~~~~~~~
  7. enum DSP_RETURN {
  8.                   dsp_INIT_FAILLED = 0,
  9.                   dsp_INIT_OK      = 1
  10.                 };
  11.  
  12.  
  13. //Type of output. N.B:DSP_16_BITS not implemented yet.
  14. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. enum DSP_MODE {
  16.                  DSP_8_BITS            = 0,
  17.                  DSP_8_BITS_HIGH_SPEED = 1,
  18.                  DSP_16_BITS           = 2
  19.               };
  20.  
  21.  
  22. //Control class for sound blaster dsp.
  23. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  24. class DSP_CONTROL
  25. {
  26.    public:
  27.           DSP_CONTROL( unsigned port = 0, unsigned irq = 0, unsigned mode = DSP_8_BITS );
  28.  
  29.           void Continue( void ){SetRate();DspWrite(0xD4);};
  30.           void GetDspVersion( unsigned char *major, unsigned char *minor );
  31.           void Pause( void ){DspWrite(0xD0);};
  32.           void SelectDspMode( void );
  33.           void SetDspCount( unsigned length );
  34.           void SetRate( unsigned samplingRate = 0);
  35.           void SetIoPort( unsigned port ){ ioPort = port; };
  36.           void SetIrq( unsigned irq )    { interNo = irq; };
  37.           void TurnSpeakerOff( void );
  38.           void TurnSpeakerOn( void );
  39.  
  40.           unsigned InitDsp( void );
  41.           unsigned GetIoPort( void )     { return ioPort; };
  42.           unsigned GetIrq( void )        { return interNo; };
  43.           unsigned GetRate( void ) {return rate;};
  44.           unsigned GetMode( void ) {return dspMode;};
  45.  
  46.  
  47.  
  48.  
  49.    protected:
  50.              void DspWrite( unsigned char byte );
  51.              unsigned char DspRead( void );
  52.              unsigned ioPort, interNo,transfertType, dspMode, rate;
  53.              unsigned char timeConstant;
  54. };
  55.  
  56. #endif